import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home/index.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path:'/',
    redirect:'/home/main'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[{
      path: '/home/main',
      name: '首页',
      component: () => import(/* webpackChunkName: "main" */ '../views/Home/Main/index.vue')
    },{
      path: '/home/forum',
      name: '论坛',
      component: () => import(/* webpackChunkName: "forum" */ '../views/Home/Forum/index.vue')
    },{
      path: '/home/chance',
      name: '选车',
      component: () => import(/* webpackChunkName: "chance" */ '../views/Home/Chance/index.vue')
    },{
      path: '/home/beijing',
      name: '北京',
      component: () => import(/* webpackChunkName: "beijing" */ '../views/Home/Beijing/index.vue')
    },{
      path: '/home/my',
      name: '我的',
      component: () => import(/* webpackChunkName: "my" */ '../views/Home/My/index.vue')
    },]
  },
  {
    path: '/detail',
    name: 'Detail',
    component: () => import(/* webpackChunkName: "about" */ '../views/Detail/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
